﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace hse_2013_twinpics
{
    public partial class Elementpic : PictureBox
    {
        private bool isopen = false;
        private int picindex;

        /// <summary>
        /// "True" - картинка открыта, иначе скрыта за рубашкой
        /// </summary>
        public bool IsOpen { get { return isopen; } set { isopen = value; } }

        /// <summary>
        /// Номер картинки, нужен для сравнения одинаковых
        /// </summary>
        public int PicIndex { get { return picindex; } set { picindex = value; } }
        public Elementpic(int picindex)
        {
            InitializeComponent();
            this.picindex = picindex;
        }

        /// <summary>
        /// Метод сравнения
        /// </summary>
        /// <param name="pic1"></param>
        /// <param name="pic2"></param>
        /// <returns></returns>
        public static bool Compare(Elementpic pic1, Elementpic pic2)
        {
            bool result;
            if (pic1.PicIndex == pic2.PicIndex)
                result = true;
            else
                result = false;
            return result;
        }

        public static void Open(Elementpic pic, Image[] mas)
        {
            pic.Image = mas[pic.PicIndex];
        }

        public static void Close(Elementpic pic, Image im)
        {
            pic.Image = im;
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            base.OnPaint(pe);
        }
    }
}
